{% extends "base.html" %}
{% set active_page = "block_details" %}
{% set page_title = "Block Details for " ~ block.currency ~ " blockheight #" ~ block.height %}
{% block body %}

<div class="col-lg-10 col-lg-offset-1">
  {% if block %}
  <h2>{{ block.currency_obj.name }} {{ _("Block") }} #{{ block.height | comma }}</h2>
  <div class="panel panel-default" style="background:none;">
    <div class="panel-heading">{{ _("Network Details") }}</div>
    <div class="table-responsive">
      <table class="table big-table table-striped table-hover">
        <tbody>
          <tr>
            <th width="30%">{{ _("Found") }}</th>
            <td data-sort-value="{{ block.timestamp }}">{{ block.found_at | human_date_utc }}</td>
          </tr>
          <tr>
            <th>{{ _("Currency") }}</th>
            <td>{{ block.currency_obj.name }} (<a href="/blocks/{{ block.currency }}">{{ block.currency }}</a>)</td>
          </tr>
          <tr>
            <th>{{ _("Algorithm") }}</th>
            <td>{{ block.algo_obj.display }}</td>
          </tr>
          <tr>
            <th>{{ _("Coinbase Value") }}</th>
            <td>{{ block.total_value | comma }} {{ block.currency }} ({{ _("with %(fee)f in fees", fee=block.transaction_fees | comma) }})</td>
          </tr>
          <tr>
            <th>{{ _("Difficulty") }}</th>
            <td>{{ block.difficulty | comma }}</td>
          </tr>
          <tr>
            <th>{{ _("Block Hash") }}</th>
            <td>
            {% if block.currency_obj.block_explore %}
              <a href="{{ block.currency_obj.block_explore ~ block.hash }}">{{ block.hash }}</a>
            {% else %}
              <samp>{{ block.hash }}</samp>
            {% endif %}
            </td>
          </tr>
          <tr>
            <th>{{ _("Blockheight") }}</th>
            <td>{{ block.height | comma }}</td>
          </tr>
          <tr>
            <th>{{ _("Status") }}</th>
            <td>{{ block.status }}</td>
          </tr>
        </tbody>
      </table>
    </div>
    <div class="panel-heading">{{ _("Mining Details") }}</div>
    <div class="table-responsive">
      <table class="table big-table table-striped table-hover">
        <tbody>
          <tr>
            <th width="30%">{{ _("Simplecoin ID") }}</th>
            <td>{{ block.id | comma }}</td>
          </tr>
          <tr>
            <th>{{ _("Solved by user") }}</th>
            <td>{% if block.user in g.anon_users %}
                  Anonymous
                {% else %}
                <a href="/stats/{{ block.user }}">{{ block.user }}</a>.{{ block.worker }}
                {% endif %}
            </td>
          </tr>
          <tr>
            <th>{{ _("Round Duration") }}</th>
            <td>{{ block.duration }}</td>
          </tr>
          <tr>
            <th>{{ _("Hashes required") }}</th>
            <td>{{ (block.hashes_to_solve or 1) | hashrate(sec=False) }}</td>
          </tr>
          <tr>
            <th>{{ _("Average hashrate") }}</th>
            <td>{{ (block.average_hashrate or 1) | hashrate }}</td>
          </tr>
          <tr>
            <th>{{ _("Shares required") }}</th>
            <td>{{ (block.shares_to_solve or 1) | comma }}</td>
          </tr>
          <tr>
            <th>{{ _("Luck") }}</th>
            <td>{{ (block.luck or 0) | comma }} %</td>
          </tr>
        </tbody>
      </table>
    </div>
    <div class="panel-heading">{{ _("Chain Distribution") }}</div>
    <div class="table-responsive">
      <table class="table big-table table-striped table-hover">
        <tbody>
          {% for chain, (shares, perc) in block.chain_distrib().iteritems() %}
          <tr>
            <td>{{ chain.title }}</td>
            <td>{{ shares | comma }} shares ({{ perc | comma }}%)</td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
  </div>
  {% else %}
  <br>
  <br>
  <center><h3>{{ _("No block by that identifier could be found in our database!") }}</h3></center>
  <br>
  <br>
  {% endif %}
</div>

{% endblock %}
